package com.itboye.ihomebank.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Environment;

/**
 * Created by Administrator on 2018/8/20 0020.
 */

public class FaceDetectionDBHelper extends SQLiteOpenHelper {

    public static final String DB_PATH = "/data"
            + Environment.getDataDirectory().getAbsolutePath() + "/"
            + "com.itboye.ihomebank"; // 存放路径

    public static final String KEYDB="face_detection.db";

    public FaceDetectionDBHelper(Context context) {
        super(context, KEYDB, null, 1);
    }
    //数据库第一次创建时候调用
    @Override
    public void onCreate(SQLiteDatabase db) {
        //调用execSQL()方法执行建表语句(人脸活体检测)
        db.execSQL("create table face_detection(id integer primary key autoincrement, url varchar(1000), isfirst varchar(50))");

//        //调用execSQL()方法执行建表语句我的钥匙列表)
//        db.execSQL("create table face_detection(id integer primary key autoincrement, lock_id varchar(50), key_id varchar(50), start varchar(50), end varchar(50), create_time varchar(50), update_time varchar(50), status varchar(50), type varchar(50), power varchar(50), lock_alias varchar(50), house_no varchar(50), user_type varchar(50), lock_mac varchar(50), push varchar(50), key_status varchar(50), is_new varchar(50))");

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // TODO Auto-generated method stub

    }
    /**
     * 删除数据库
     * @param context
     * @return
     */
    public boolean deleteDatabase(Context context) {

        return context.deleteDatabase(KEYDB);
    }
}
